<template>
	<view>
		<!-- <v-tabs v-model="current" :scroll="false" :tabs="tabs" :pills="true" line-height="0" activeColor="#fff"
			@change="changeTab">

		</v-tabs> -->
		<view class="order_container">
			<uni-list :border="true" v-for="(item,index) in orderList" :key="index" v-if="orderList.length!=0">
				<u--text bold="true" text="租借充电宝"></u--text>
				<u--text align="rigth" :text="item.cabinet.cabinetNo"></u--text>
			</uni-list>




		</view>
	</view>

	<!-- <view v-show="current == 1">暂无优惠卡订单</view> -->
	</view>
</template>

<script>
	let that;
	export default {
		data() {
			return {
				current: 0,
				tabs: ['骑行订单', '优惠卡订单'],

				setting: null,
				params: {},
				orderList: [],
				/* 全部参数 */
				params: {
					pages: 1,
				},
				listPage: {
					page: 1,
					pageSize: 0,
					totalSize: 0,
					curpage: 1
				}
			}
		},
		components: {},
		props: {},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			that = this;
			that.getData(that.params);
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {},

		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},

		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},

		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {
			this.listPage.pages = 1;
			this.params.pages = 1;
			this.getData(this.params, 2);
			uni.showNavigationBarLoading();
			uni.hideNavigationBarLoading(); //完成停止加载

			uni.stopPullDownRefresh(); //停止下拉刷新
		},

		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {


			if (that.listPage.totalSize > that.listPage.curPage * that.listPage.pageSize) {
				that.listPage.pages++;
				that.params.pages++;
				this.getData(this.params);
			}
		},
		methods: {
			changeTab(index) {
				console.log('当前选中的项：' + index)
			},
			/* 获取数据 */
			getData: function(param) {
				this.$http_api.ordersList({

				}).then((res) => {
					console.log("ordersList response :", res)
					that.orderList = res;
				});

			}
		}

	}
</script>

<style>
	@import "./index.css";
</style>